// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import com.nokia.meego 1.0

QueryDialog {
  id: myDialog
  //tools: formTools
  property alias title: karmaTitle.text;
  property int points: 0 //: pointsSelection.text;
  property int karmaId: listpanel.karmaId

  property variant indexmap: { "10": 0, '5': 1, '3': 2, '2': 3, '1': 4, '0': 5, '-1': 6, '-2': 7, '-3': 8, '-5': 9, '-10': 10 }

  acceptButtonText: qsTr("Ok")
  rejectButtonText: qsTr("Cancel")


  anchors.fill:parent

  content: Grid {
        id: grid1
        spacing: 20
        rows: 2
        columns: 2
        anchors{
            top:parent.top
            left: parent.left
            right: parent.right
            topMargin: 20
        }
        Label{id:desc; text:qsTr("Description"); height: 40;color: "white" }
        TextField{
            id:karmaTitle;

        }
        Label{text:qsTr("Points"); height: 40;color: "white" }
        TextField{
            id: pointsSelection
            text: selectionDialog.model.get(indexmap[points]).name

            readOnly: true

            KarmaSelectionDialog {
                id: selectionDialog

                onAccepted :{
                    pointsSelection.text = model.get(selectedIndex).name;
                    points = model.get(selectedIndex).value;
                    pointsSelection.cursorPosition= 0
                }
            }

            MouseArea{
                anchors.fill: parent;
                onClicked: selectionDialog.open();
            }
        }
    }
}
